fix(common): pass freeform genres through to SDK instead of reverting to Electronic#14479
Merged
Conversation
… to Electronic toSdkGenre in the track adapter filtered out any value not in the canonical Genre enum and returned undefined, which then fell back to DEFAULT_GENRE (Electronic) before reaching the SDK. As a result, custom/freeform genres entered by artists were silently lost on save, even though the API, ETL indexer, and SDK upload schema all already accept any non-empty string up to 100 chars. Now any non-empty genre string is passed through unchanged; the empty case still falls back to Electronic (genre is required). Removes the now-unused VALID_GENRES set and adds regression tests. Re-applies the fix from #14465, which was closed inadvertently after the backend half (go-openaudio #351) merged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 103f980 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14479.audius.workers.dev Unique preview for this PR (deployed from this branch). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When an artist enters a freeform/custom genre on the track edit/upload form, it silently reverts to Electronic after saving.
Root cause
toSdkGenreinpackages/common/src/adapters/track.tsfiltered out any value not in the canonicalGenreenum and returnedundefined. Thatundefinedthen fell back toDEFAULT_GENRE = Genre.Electronicbefore being sent to the SDK:This is the last missing piece of the freeform-genres feature. The backend already accepts any non-empty genre string up to 100 chars:
feat(tracks): allow custom genres; cap at 100 chars(slash discrepancy test #879)SelectGenreFieldrewrite — feat(genres): allow custom track genres #14424 (merged)…but the web write-path adapter still corrupted custom genres to Electronic, so the feature wasn't actually live end-to-end on web.
Fix
Pass any non-empty genre string through unchanged. The empty case still falls back to Electronic (genre is required). Removes the now-unused
VALID_GENRESset and adds regression tests.Note
Re-applies the fix from #14465, which was closed inadvertently after the backend half merged — there was no superseding PR and
mainstill had the bug.Validation
tsc --noEmit— no new errors (one pre-existing unrelatedEvent.tserror remains onmain)eslint— cleanvitest src/adapters/track.test.ts— 5/5 pass (added 3 regression tests: freeform passthrough, canonical preserved, empty → Electronic)🤖 Generated with Claude Code